/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */
'use strict';
import React, {
    Component,
} from 'react';

import {
    StyleSheet,
    Text,
    View,
    ScrollView,
    Image,
    TextInput,
    ToolbarAndroid,
    TouchableHighlight,
    ProgressBarAndroid,
    Alert,
    ToastAndroid,
    Dimensions
} from 'react-native';

import md5 from 'md5'
import StringEx from '../utils/stringex'
import CommonStyles from '../styles/common';
import LoadingView from './custom/loadingView';
import { SignIn,CleanAuthrizatuon,OpenidSignIn} from '../actions/userActions';
import {Actions} from 'react-native-router-flux'
import FontAwesome from 'react-native-vector-icons/FontAwesome'
import * as QQAPI from 'react-native-qq';

var interval=null;
export default class LoginBindOpenid extends Component {
    constructor(props) {
        super(props);
        this.state={
            userName:'',
            password:''
        };
    }
    
    onPressBind(catalog){
        Alert.alert('系统提示',catalog+'绑定暂未实现！');
    }
    
    render() {
        if (this.props.isLoading)
        {
            return (<LoadingView progress={this.props.isLoading?0:1} tip='登录中...'/>);
        }
          
        return (
            <View style={CommonStyles.container}>
                <ScrollView contentContainerStyle={[CommonStyles.padding10,CommonStyles.marginNavTop]}>
                    <TextInput
                        style={CommonStyles.input}
                        placeholder='邮箱/用户名' onChangeText={(text) => this.setState({userName:text})} value={this.state.userName}/>
                    <TextInput
                        style={CommonStyles.input}
                        placeholder='密码'
                        password={true} onChangeText={(text) => this.setState({password:text})} value={this.state.password}/>

                    <TouchableHighlight
                        style={[CommonStyles.button,{backgroundColor:'#5FC4D0'}]}
                        underlayColor='#87ceeb'
                        onPress={this.onPressBind.bind(this,this.props.catalog)}>
                        <Text style={[CommonStyles.buttonText,CommonStyles.font16]}>确认绑定</Text>
                    </TouchableHighlight>             
                </ScrollView>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    otherLoginView:{
        flex:1,
        marginTop:30
    },
    otherLoginText:{
        fontSize:16,
        marginBottom:10
    },
    QQLoginBg:{
        width:40,
        height:40,
        justifyContent:'center',
        alignItems:'center',
        backgroundColor:'#77C1FE',
        borderWidth: 0,
        borderRadius: 20,
    }
});
